<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    

    <title>{$Think.config.site.title} - 手动入库</title>
    <meta name="keywords" content="{$Think.config.site.keywords}">
    <meta name="description" content="{$Think.config.site.description}">

    <link href="{$Think.config.site.resource_url}css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/animate.min.css" rel="stylesheet">
    <link href="{$Think.config.site.resource_url}css/style.min.css?v=4.0.0" rel="stylesheet">
    <link href="{$Think.config.site.common_resource_url}js/chosen/chosen.css" rel="stylesheet" type="text/css"/>
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
      <form method="get" class="form-horizontal">
      <div class="row">
          <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>入库信息</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                      	</div>
                    </div>
                    <div class="ibox-content">
                        
                        	<input type="hidden" name="specval_id" value="{$info.specval_id}" />
                        	<input type="hidden" name="goods_id" value="{$info.goods_id}" />
                        	<input type="hidden" name="specval_name" value="{$info.specval_name}" />
                      
                            <div class="form-group">
                                <label class="col-sm-3 control-label">商品名称</label>
                                <div class="col-sm-9">
                                    <input  class="form-control" type="text" value="{$info.goods_name}" disabled="true">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">商品品牌</label>
                                <div class="col-sm-9">
                                    <input  class="form-control" type="text" value="{$info.brand_name}" disabled="true">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">供应商</label>
                                <div class="col-sm-9">
                                    <input  class="form-control" type="text" value="{$info.supplier_name}" disabled="true">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">库存数量</label>
                                <div class="col-sm-9">
                                    <input  class="form-control" type="text" value="{$info.stock_num}" disabled="true">
                                </div>
                            </div>
                            <div class="hr-line-dashed"></div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">入库数量</label>
                                <div class="col-sm-9">
                                    <input id="stock_num" name="stock_num" class="form-control" type="text" value="">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">入库单价</label>
                                <div class="col-sm-9">
                                    <input id="lastent_price" name="lastent_price" class="form-control" type="text" value="">
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-sm-3 control-label">备注</label>
                                <div class="col-sm-9">
                                    <textarea name="remark" class="form-control"></textarea>
                                </div>
                            </div>
                            
                            <div class="hr-line-dashed"></div>
                            <div class="form-group">
                                <div class="col-sm-5 col-sm-offset-3">
     
                                    <input type="submit" class="btn btn-primary" value="提交">
                           
                                </div>
                            </div>
                    </div>
                </div>
            </div>
        </div>
        </form>
    </div>

    <script src="{$Think.config.site.resource_url}js/jquery.min.js?v=2.1.4"></script>
    <script src="{$Think.config.site.resource_url}js/bootstrap.min.js?v=3.3.5"></script>
    <script src="{$Think.config.site.resource_url}js/content.min.js?v=1.0.0"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/validate/jquery.validate.min.js"></script>
    <script src="{$Think.config.site.resource_url}js/plugins/validate/messages_zh.min.js"></script>
  	<script src="{$Think.config.site.resource_url}js/plugins/layer/layer.js"></script>
  	<script src="{$Think.config.site.resource_url}js/plugins/iCheck/icheck.min.js"></script>
  	<script src="{$Think.config.site.common_resource_url}js/majax.js"></script>
  	<script src="{$Think.config.site.common_resource_url}js/laydate/laydate.js"></script>
    <script type="text/javascript" src="{$Think.config.site.common_resource_url}js/chosen/chosen.jquery.js"></script>
</body>

</html>
<script>


$(document).ready(function(){


	$("form").validate({
	  debug:true,
	  submitHandler:function(form){
            save();   
      },    
	  rules: {
		stock_num: {
            required: true,
            number:true,
		},

		lastent_price: {
            required: true,
            number:true,
		},
		
	  },
	  messages: {
		stock_num: {
		  required: '入库数量必须填写',
		  number: '入库数量必须是数字'
		},
		lastent_price: {
		  required: '入库单价必须填写',
		  number: '入库单价必须是数字'
		},
	  }
	});

	function save(){
		var fomrData = $("form").serialize();

		majax('{:url("actEsbh")}',fomrData,function(d){
			if (d.code>0) {
				window.parent.editSuccess(d);
			}else{
				layer.msg(d.msg, {icon: 5});
			}
		})
	};
})
</script>